// 
// Decompiled by Procyon v0.5.36
// 

package com.orange.boot.pm2.service.impl;

import java.util.stream.Collector;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.orange.boot.environment.entity.EnvironmentData;
import java.util.List;
import org.springframework.stereotype.Service;
import com.orange.boot.pm2.service.EnvironmentData20Service;
import com.orange.boot.pm2.entity.EnvironmentData20;
import com.orange.boot.pm2.mapper.EnvironmentData20Mapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

@Service
public class EnvironmentData20ServiceImpl extends ServiceImpl<EnvironmentData20Mapper, EnvironmentData20> implements EnvironmentData20Service {
    public EnvironmentData20ServiceImpl() {
    }

    public List<EnvironmentData> getEnvironmentalData(String code) {
        QueryWrapper<EnvironmentData20> queryWrapper = (QueryWrapper)((QueryWrapper)((QueryWrapper)(new QueryWrapper()).eq("code", code)).orderByDesc("gmt_create")).last("LIMIT 10");
        List<EnvironmentData20> environmentData20s = ((EnvironmentData20Mapper)this.baseMapper).selectList(queryWrapper);
        List<EnvironmentData> dataList = (List)environmentData20s.stream().map((tar) -> {
            return new EnvironmentData(tar.getCode(), tar.getValue(), tar.getUnit(), tar.getGmtCreate());
        }).collect(Collectors.toList());
        return dataList.size() != 0 ? dataList : null;
    }
}
